// ConfigTimePage.cpp : implementation file
//

#include "stdafx.h"
#include "SFDL3.h"
#include "ConfigTimePage.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CConfigTimePage dialog


CConfigTimePage::CConfigTimePage(CConfiguration* config)
	: CPropertyPage(CConfigTimePage::IDD),
	m_pConfig(config)
{
	//{{AFX_DATA_INIT(CConfigTimePage)
	m_ContMinites = m_pConfig->m_MaxContMinutes;
	m_DayHours = m_pConfig->m_MaxDayHours;
	m_SleepInterval = m_pConfig->m_SleepNotiInterval;
	m_SleepHour = m_pConfig->m_LatestSleepHour;
	//}}AFX_DATA_INIT
}


void CConfigTimePage::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CConfigTimePage)
	DDX_Text(pDX, IDC_EDIT_CONT_MIN, m_ContMinites);
	DDV_MinMaxInt(pDX, m_ContMinites, 1, 60);
	DDX_Text(pDX, IDC_EDIT_DAYLIM, m_DayHours);
	DDV_MinMaxInt(pDX, m_DayHours, 0, 12);
	DDX_Text(pDX, IDC_EDIT_INTERVAL, m_SleepInterval);
	DDV_MinMaxInt(pDX, m_SleepInterval, 1, 60);
	DDX_Text(pDX, IDC_EDIT_SLHOUR, m_SleepHour);
	DDV_MinMaxInt(pDX, m_SleepHour, 0, 24);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CConfigTimePage, CDialog)
	//{{AFX_MSG_MAP(CConfigTimePage)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CConfigTimePage message handlers

BOOL CConfigTimePage::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CConfigTimePage::OnOK()
{
	m_pConfig->m_MaxContMinutes=m_ContMinites;
	m_pConfig->m_MaxDayHours=m_DayHours;

	m_pConfig->m_LatestSleepHour=m_SleepHour;
	m_pConfig->m_SleepNotiInterval=m_SleepInterval;
}